package demo1.Assignment3;

import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

public class UserInfo implements IUserInfo {
    private static final AtomicInteger atomicInt = new AtomicInteger();
    private String number;
    private String id;
    private String homeAddress;
    private Map<String, String> teles;
    private String name;

    public UserInfo() {
        this.id = String.valueOf(atomicInt.incrementAndGet());
    }

    @Override
    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    @Override
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Override
    public String getUserHomeAddress() {
        return homeAddress;
    }

    public void setHomeAddress(String homeAddress) {
        this.homeAddress = homeAddress;
    }

    public void setTeles(Map<String, String> teles) {
        this.teles = teles;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public Map<String, String> getUserTeles() {
        return teles;
    }

    @Override
    public String getName() {
        return name;
    }

    public static void main(String[] args) {
        //id为从1开始的自增长数值
        for (int i = 0; i < 5; i++) {
            UserInfo userInfo = new UserInfo();
            System.out.println(userInfo.getId());
        }
    }
}
